<template>
  <o-modal
    v-model="isShow"
    :title="config.modalTitle"
    :size="config.modalSize"
    :mask="true"
    :tap-close="false"
    :show-footer="true"
    @on-ok="urgentOk"
    @on-close="urgentClose"
  >
    <div slot="content" class="urgentbox clear">
      <RadioGroup v-model="selID">
        <Radio v-for="item in urgentData" :label="item.selID" :key="item.selID">
          <span>{{ item.seltitle }}</span>
        </Radio>
      </RadioGroup>
    </div>
  </o-modal>
</template>

<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator';
import oModal from '@/components/base/modal/o-modal/index.vue';
import { RadioGroup, Radio } from 'view-design';
import { Tsrv } from '@/services';

interface config {
  modalTitle?: string;
  modalSize?: Array<number>;
}

@Component({
  components: {
    oModal
  }
})
export default class oAuditUrgent extends Vue {
  @Prop() config: config;

  @Prop() id: string;

  private isShow: boolean = false;

  private selID: number = 0;

  private urgentData: any = [
    {
      selID: 0,
      // seltitle: "普通送审"
      seltitle: Tsrv.getI18nByPath('oAuditUrgent.ordinarysubmission')
    },
    {
      selID: 1,
      // seltitle: "加急送审"
      seltitle: Tsrv.getI18nByPath('oAuditUrgent.expeditedreview')
    }
  ];

  created() {}

  mounted() {
    this.show();
  }

  public show() {
    this.isShow = true;
  }

  public hide() {
    this.$bus.$emit(`modal_${this.id}`);
    this.isShow = false;
  }

  public urgentOk() {
    this.$bus.$emit(`modal_${this.id}`, this.selID);
    this.hide();
  }

  public urgentClose() {
    this.hide();
  }
}
</script>

<style lang="scss" scoped>
.urgentbox {
  padding: 0 20px;
  height: 100%;
  overflow-y: scroll;

  &::-webkit-scrollbar {
    width: 6px;
    background: #f5f5f5;
    border-radius: 6px;
  }
  &::-webkit-scrollbar-track-piece {
    background: #fff;
    border-radius: 6px;
  }
  &::-webkit-scrollbar-thumb {
    background: #b1b1b1;
    border-radius: 6px;
  }
  .ivu-radio-wrapper {
    width: 45%;
    padding: 4px 0;
    margin-right: 5%;
    ::v-deep .ivu-radio-inner:after {
      border-radius: 6px;
    }
  }
  .ivu-radio-group {
    width: 100%;
  }
}
</style>
